

var changeTime = null;
jQuery(document).ready(function(){
    
    
    changeTime = setInterval('showDefferTime()', 1000);
    
});


function showDefferTime(){
    showCurrentDateTime('beijing', 'beijing');
    showCurrentDateTime('newyork', 'newyork');
    showCurrentDateTime('london', 'london');
    showCurrentDateTime('sydney', 'sydney');
    showCurrentDateTime('tokyo', 'tokyo');
}

function  showCurrentDateTime(elemId, timeZone){
    
    var currentTime = new Date();
    if(!timeZone || timeZone == 'beijing'){
        
    }
    else if(timeZone == 'newyork'){
        currentTime = new Date(currentTime.getTime()/1 - 13*3600000);
    }
    else if(timeZone == 'london'){
        currentTime = new Date(currentTime.getTime()/1 - 7*3600000);
    }
    else if(timeZone == 'sydney'){
        currentTime = new Date(currentTime.getTime()/1 + 2*3600000);
    }
    else if(timeZone == 'tokyo'){
        currentTime = new Date(currentTime.getTime()/1 + 1*3600000);
    }
    
    
    var timeStr = currentTime.getHours() < 10 ? '0' + currentTime.getHours() : currentTime.getHours();
    timeStr += currentTime.getMinutes() < 10 ? ':0'+currentTime.getMinutes() : ':' + currentTime.getMinutes();
    timeStr += currentTime.getSeconds() < 10 ? ':0' + currentTime.getSeconds() : ':' + currentTime.getSeconds();
    jQuery('#' + elemId).text(timeStr);
}